<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<link rel="stylesheet" href="./framework/font-awesome-4.7.0/css/font-awesome.min.css">
		<link rel="stylesheet" href="./framework/reset.css">
		<link rel="stylesheet" href="./framework/common.css">
		<link rel="stylesheet" href="./css/feedbackList.css">
		<title>东软环保公众监督系统-公众监督员端-反馈信息列表</title>
		<script src="js/base.js"></script>
	</head>
	<body>
		<!-- 总容器 -->
		<div class="wrapper">
			<div class="header-box">
				<header>
					<i class="fa fa-angle-left" onclick="history.go(-1)"></i>
					<p>历史反馈信息列表</p>
					<i class="fa fa-th" onclick="location.href='selectGrid.html'"></i>
				</header>
				<div class="top-ban"></div>
				<img src="./img/header.png">
			</div>

			<ul id="PageList">

			</ul>
			<div id="info" style="text-align: center;font-size: 22px;background-color: aquamarine;"
				onclick="onNextPage()">点击加载更多
			</div>
		</div>

	</body>
</html>
<script>
	let lastItemId = -1;

	function onNextPage() {
		let url = "http://localhost:8080/AqiFeedBack/supervisorPage?pageSize=5&lastItemId=" + lastItemId;
		rest(url, "get", null, function(r) {
			if (r.ok) {
				let feedbackArr = r.data.feedbacks;
				if (feedbackArr.length == 0) {
					document.getElementById("info").innerHTML = "我是有底线的";
					return;
				}
				lastItemId = feedbackArr[feedbackArr.length - 1].afId;
				let innerHTML = document.getElementById("PageList").innerHTML; // 初始化innerHTML为空字符串  
				for (let i = 0; i < feedbackArr.length; i++) {
					let feedback = feedbackArr[i];
					innerHTML += "<li>\n" +
						"\t\t\t\t\t<div>\n" +
						"\t\t\t\t\t\t<i style=\"background-color:" + feedback.color + ";\">" + feedback
						.chineseExplain + "</i>\n" +
						"\t\t\t\t\t\t<span>" + feedback.afDate + " " + feedback.afTime + "</span>\n" + // 嵌入变量值  
						"\t\t\t\t\t</div>\n" +
						"\t\t\t\t\t<div>" + feedback.provinceName + "</div>\n" + // 嵌入变量值  
						"\t\t\t\t\t<div>" + feedback.cityName + "</div>\n" + // 嵌入变量值  
						"\t\t\t\t</li>";
				}
				document.getElementById("PageList").innerHTML = innerHTML;
			}
		})
	}
	onNextPage();
</script>